package windbell.domain.common;

import com.google.common.base.Objects;
import java.util.Map;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@SuppressWarnings("all")
public class Collections {
  public static <K extends Object, V extends Object> void fillEmpty(final Map<K,V> results, final Iterable<K> allKeys, final Function1<? super K,? extends V> gen) {
    final Procedure1<K> _function = new Procedure1<K>() {
        public void apply(final K it) {
          V _get = results.get(it);
          boolean _equals = Objects.equal(_get, null);
          if (_equals) {
            V _apply = gen.apply(it);
            results.put(it, _apply);
          }
        }
      };
    IterableExtensions.<K>forEach(allKeys, _function);
  }
}
